package com.javasm.process.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.javasm.process.dao.ProcessDefMapper;
import com.javasm.process.entity.ProcessDef;
import com.javasm.process.service.ProcessDefService;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ProcessDefServiceimpl extends ServiceImpl<ProcessDefMapper, ProcessDef> implements ProcessDefService {
    @Override
    public ProcessDef getNextDef(String pname, Integer currentLeveal) {
        QueryWrapper w = new QueryWrapper();
        w.eq("pname",pname);
        w.eq("task_leveal",currentLeveal+1);
        ProcessDef one = getOne(w);
        return one;
    }

    @Override
    public ProcessDef getCurrentDef(String defName, String taskName) {
        QueryWrapper w = new QueryWrapper();
        w.eq("pname",defName);
        w.eq("task_name",taskName);
        ProcessDef one = getOne(w);
        return one;
    }

    @Override
    public List<ProcessDef> listProcessDefAndDeptAndPos(ProcessDef def) {
        return this.baseMapper.listProcessDefAndDeptAndPos(def);
    }
}
